From cb4ec6f3840fe709adbd290f71e5d245530d1b16 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Wed, 21 Mar 2018 20:15:21 +0100 Subject: [PATCH] gdk: Remove GdkSurfaceImpl::shape_combine_region vfunc ... and all the implementations. Input shapes still exist. --- gdk/broadway/gdksurface-broadway.c | 9 ----- gdk/gdksurfaceimpl.h | 4 -- gdk/quartz/gdksurface-quartz.c | 10 ----- gdk/wayland/gdksurface-wayland.c | 9 ----- gdk/win32/gdksurface-win32.c | 61 ------------------------------ gdk/x11/gdksurface-x11.c | 60 +++++++++-------------------- 6 files changed, 17 insertions(+), 136 deletions(-) diff --git a/gdk/broadway/gdksurface-broadway.c b/gdk/broadway/gdksurface-broadway.c index 06ba909c57..29c449d7f1 100644 --- a/gdk/broadway/gdksurface-broadway.c +++ b/gdk/broadway/gdksurface-broadway.c @@ -635,14 +635,6 @@ gdk_surface_broadway_set_events (GdkSurface *surface, } } -static void -gdk_surface_broadway_shape_combine_region (GdkSurface *surface, - const cairo_region_t *shape_region, - gint offset_x, - gint offset_y) -{ -} - static void gdk_surface_broadway_input_shape_combine_region (GdkSurface *surface, const cairo_region_t *shape_region, @@ -1381,7 +1373,6 @@ gdk_surface_impl_broadway_class_init (GdkSurfaceImplBroadwayClass *klass) impl_class->get_geometry = gdk_surface_broadway_get_geometry; impl_class->get_root_coords = gdk_surface_broadway_get_root_coords; impl_class->get_device_state = gdk_surface_broadway_get_device_state; - impl_class->shape_combine_region = gdk_surface_broadway_shape_combine_region; impl_class->input_shape_combine_region = gdk_surface_broadway_input_shape_combine_region; impl_class->destroy = _gdk_broadway_surface_destroy; impl_class->end_paint = gdk_broadway_surface_end_paint; diff --git a/gdk/gdksurfaceimpl.h b/gdk/gdksurfaceimpl.h index a2488db5e3..5e83072f55 100644 --- a/gdk/gdksurfaceimpl.h +++ b/gdk/gdksurfaceimpl.h @@ -103,10 +103,6 @@ struct _GdkSurfaceImplClass gboolean (* begin_paint) (GdkSurface *surface); void (* end_paint) (GdkSurface *surface); - void (* shape_combine_region) (GdkSurface *surface, - const cairo_region_t *shape_region, - gint offset_x, - gint offset_y); void (* input_shape_combine_region) (GdkSurface *surface, const cairo_region_t *shape_region, gint offset_x, diff --git a/gdk/quartz/gdksurface-quartz.c b/gdk/quartz/gdksurface-quartz.c index 73ef9ca422..f25ceb4f75 100644 --- a/gdk/quartz/gdksurface-quartz.c +++ b/gdk/quartz/gdksurface-quartz.c @@ -1823,15 +1823,6 @@ gdk_quartz_surface_set_transient_for (GdkSurface *window, GDK_QUARTZ_RELEASE_POOL; } -static void -gdk_surface_quartz_shape_combine_region (GdkSurface *window, - const cairo_region_t *shape, - gint x, - gint y) -{ - /* FIXME: Implement */ -} - static void gdk_surface_quartz_input_shape_combine_region (GdkSurface *window, const cairo_region_t *shape_region, @@ -2764,7 +2755,6 @@ gdk_surface_impl_quartz_class_init (GdkSurfaceImplQuartzClass *klass) impl_class->get_geometry = gdk_surface_quartz_get_geometry; impl_class->get_root_coords = gdk_surface_quartz_get_root_coords; impl_class->get_device_state = gdk_surface_quartz_get_device_state; - impl_class->shape_combine_region = gdk_surface_quartz_shape_combine_region; impl_class->input_shape_combine_region = gdk_surface_quartz_input_shape_combine_region; impl_class->destroy = gdk_quartz_surface_destroy; impl_class->begin_paint = gdk_surface_impl_quartz_begin_paint; diff --git a/gdk/wayland/gdksurface-wayland.c b/gdk/wayland/gdksurface-wayland.c index 04811eb08f..c756c9a3f8 100644 --- a/gdk/wayland/gdksurface-wayland.c +++ b/gdk/wayland/gdksurface-wayland.c @@ -2761,14 +2761,6 @@ gdk_surface_wayland_get_device_state (GdkSurface *surface, return return_val; } -static void -gdk_surface_wayland_shape_combine_region (GdkSurface *surface, - const cairo_region_t *shape_region, - gint offset_x, - gint offset_y) -{ -} - static void gdk_surface_wayland_input_shape_combine_region (GdkSurface *surface, const cairo_region_t *shape_region, @@ -3616,7 +3608,6 @@ _gdk_surface_impl_wayland_class_init (GdkSurfaceImplWaylandClass *klass) impl_class->get_geometry = gdk_surface_wayland_get_geometry; impl_class->get_root_coords = gdk_surface_wayland_get_root_coords; impl_class->get_device_state = gdk_surface_wayland_get_device_state; - impl_class->shape_combine_region = gdk_surface_wayland_shape_combine_region; impl_class->input_shape_combine_region = gdk_surface_wayland_input_shape_combine_region; impl_class->destroy = gdk_wayland_surface_destroy; impl_class->begin_paint = gdk_surface_impl_wayland_begin_paint; diff --git a/gdk/win32/gdksurface-win32.c b/gdk/win32/gdksurface-win32.c index 1156653e9d..49cdb4f589 100644 --- a/gdk/win32/gdksurface-win32.c +++ b/gdk/win32/gdksurface-win32.c @@ -2227,32 +2227,6 @@ gdk_win32_surface_set_events (GdkSurface *window, impl->native_event_mask = GDK_STRUCTURE_MASK | event_mask; } -static void -do_shape_combine_region (GdkSurface *window, - HRGN hrgn, - gint x, gint y) -{ - RECT rect; - GdkSurfaceImplWin32 *impl = GDK_SURFACE_IMPL_WIN32 (window->impl); - - GetClientRect (GDK_SURFACE_HWND (window), &rect); - - _gdk_win32_adjust_client_rect (window, &rect); - - OffsetRgn (hrgn, -rect.left, -rect.top); - OffsetRgn (hrgn, x, y); - - /* If this is a top-level window, add the title bar to the region */ - if (GDK_SURFACE_TYPE (window) == GDK_SURFACE_TOPLEVEL) - { - HRGN tmp = CreateRectRgn (0, 0, rect.right - rect.left, -rect.top); - CombineRgn (hrgn, hrgn, tmp, RGN_OR); - DeleteObject (tmp); - } - - SetWindowRgn (GDK_SURFACE_HWND (window), hrgn, TRUE); -} - static void gdk_win32_surface_set_accept_focus (GdkSurface *window, gboolean accept_focus) @@ -4148,8 +4122,6 @@ point_in_window (GdkSurface *window, { return x >= 0 && x < window->width && y >= 0 && y < window->height && - (window->shape == NULL || - cairo_region_contains_point (window->shape, x, y)) && (window->input_shape == NULL || cairo_region_contains_point (window->input_shape, x, y)); } @@ -5343,38 +5315,6 @@ cairo_region_to_hrgn (const cairo_region_t *region, return (hrgn); } -static void -gdk_win32_surface_shape_combine_region (GdkSurface *window, - const cairo_region_t *shape_region, - gint offset_x, - gint offset_y) -{ - GdkSurfaceImplWin32 *impl; - - if (GDK_SURFACE_DESTROYED (window)) - return; - - if (!shape_region) - { - GDK_NOTE (MISC, g_print ("gdk_win32_surface_shape_combine_region: %p: none\n", - GDK_SURFACE_HWND (window))); - SetWindowRgn (GDK_SURFACE_HWND (window), NULL, TRUE); - } - else - { - HRGN hrgn; - impl = GDK_SURFACE_IMPL_WIN32 (window->impl); - - hrgn = cairo_region_to_hrgn (shape_region, 0, 0, impl->surface_scale); - - GDK_NOTE (MISC, g_print ("gdk_win32_surface_shape_combine_region: %p: %p\n", - GDK_SURFACE_HWND (window), - hrgn)); - - do_shape_combine_region (window, hrgn, offset_x, offset_y); - } -} - GdkSurface * gdk_win32_surface_lookup_for_display (GdkDisplay *display, HWND anid) @@ -5890,7 +5830,6 @@ gdk_surface_impl_win32_class_init (GdkSurfaceImplWin32Class *klass) impl_class->get_device_state = gdk_surface_win32_get_device_state; impl_class->get_root_coords = gdk_win32_surface_get_root_coords; - impl_class->shape_combine_region = gdk_win32_surface_shape_combine_region; impl_class->input_shape_combine_region = gdk_win32_input_shape_combine_region; impl_class->destroy = gdk_win32_surface_destroy; impl_class->begin_paint = gdk_win32_surface_begin_paint; diff --git a/gdk/x11/gdksurface-x11.c b/gdk/x11/gdksurface-x11.c index d3d3e3f00d..54a101eb91 100644 --- a/gdk/x11/gdksurface-x11.c +++ b/gdk/x11/gdksurface-x11.c @@ -2757,38 +2757,32 @@ gdk_surface_x11_set_events (GdkSurface *surface, } } -static inline void -do_shape_combine_region (GdkSurface *surface, - const cairo_region_t *shape_region, - gint offset_x, - gint offset_y, - gint shape) +static void +gdk_surface_x11_input_shape_combine_region (GdkSurface *surface, + const cairo_region_t *shape_region, + gint offset_x, + gint offset_y) { +#ifdef ShapeInput GdkSurfaceImplX11 *impl = GDK_SURFACE_IMPL_X11 (surface->impl); if (GDK_SURFACE_DESTROYED (surface)) return; + if (!gdk_display_supports_input_shapes (GDK_SURFACE_DISPLAY (surface))) + return; + if (shape_region == NULL) { - /* Use NULL mask to unset the shape */ - if (shape == ShapeBounding - ? gdk_display_supports_shapes (GDK_SURFACE_DISPLAY (surface)) - : gdk_display_supports_input_shapes (GDK_SURFACE_DISPLAY (surface))) - { - XShapeCombineMask (GDK_SURFACE_XDISPLAY (surface), - GDK_SURFACE_XID (surface), - shape, - 0, 0, - None, - ShapeSet); - } + XShapeCombineMask (GDK_SURFACE_XDISPLAY (surface), + GDK_SURFACE_XID (surface), + ShapeInput, + 0, 0, + None, + ShapeSet); return; } - - if (shape == ShapeBounding - ? gdk_display_supports_shapes (GDK_SURFACE_DISPLAY (surface)) - : gdk_display_supports_input_shapes (GDK_SURFACE_DISPLAY (surface))) + else { gint n_rects = 0; XRectangle *xrects = NULL; @@ -2799,7 +2793,7 @@ do_shape_combine_region (GdkSurface *surface, XShapeCombineRectangles (GDK_SURFACE_XDISPLAY (surface), GDK_SURFACE_XID (surface), - shape, + ShapeInput, offset_x * impl->surface_scale, offset_y * impl->surface_scale, xrects, n_rects, @@ -2808,25 +2802,6 @@ do_shape_combine_region (GdkSurface *surface, g_free (xrects); } -} - -static void -gdk_surface_x11_shape_combine_region (GdkSurface *surface, - const cairo_region_t *shape_region, - gint offset_x, - gint offset_y) -{ - do_shape_combine_region (surface, shape_region, offset_x, offset_y, ShapeBounding); -} - -static void -gdk_surface_x11_input_shape_combine_region (GdkSurface *surface, - const cairo_region_t *shape_region, - gint offset_x, - gint offset_y) -{ -#ifdef ShapeInput - do_shape_combine_region (surface, shape_region, offset_x, offset_y, ShapeInput); #endif } @@ -4892,7 +4867,6 @@ gdk_surface_impl_x11_class_init (GdkSurfaceImplX11Class *klass) impl_class->get_geometry = gdk_surface_x11_get_geometry; impl_class->get_root_coords = gdk_surface_x11_get_root_coords; impl_class->get_device_state = gdk_surface_x11_get_device_state; - impl_class->shape_combine_region = gdk_surface_x11_shape_combine_region; impl_class->input_shape_combine_region = gdk_surface_x11_input_shape_combine_region; impl_class->destroy = gdk_x11_surface_destroy; impl_class->beep = gdk_x11_surface_beep; -- 2.30.2